package com.ruoyi.project.drug.service.impl;

import com.ruoyi.project.drug.domain.DrugInbound;
import com.ruoyi.project.drug.mapper.DrugInboundMapper;
import com.ruoyi.project.drug.service.DrugInboundcheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DrugInboundcheckServiceImpl implements DrugInboundcheckService {

    @Autowired
    private DrugInboundMapper drugInboundMapper;
    @Override
    public List<DrugInbound> selectDrugInbound(DrugInbound drugInbound) {
        return drugInboundMapper.selectDrugInbound(drugInbound);
    }

    @Override
    public int updateDrugInboundStatus(DrugInbound drugInbound) {
        if (drugInbound.getStatus().equals("1")){
            drugInbound.setStatus("0");
            int i = drugInboundMapper.updateInbound(drugInbound);
            return i;
        }
        if (drugInbound.getStatus().equals("0")){
            drugInbound.setStatus("1");
            int i = drugInboundMapper.updateInbound(drugInbound);
            return i;
        }
        return -1;
    }
}
